package com.zxc.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class StudentInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
        Object stuidObj =  request.getSession().getAttribute("stuid");
        if (stuidObj == null) {
            response.sendRedirect("/exit");
            return false;
        }


        return true;

    }

}
